import request from "@/utils/request.js";
import { saveAs } from "file-saver";
export default {
  dataAll(params = {}) {
    console.log(params, "----");
    return request.get("/myData/list", { params });
  },
  downLoadExcel(params = {}, filename = "modbus.xlsx") {
    return request
      .post("/myData/exportExcel", params, { responseType: "blob" })
      .then((data) => {
        const blob = new Blob([data]);
        saveAs(blob, filename);
      });
  },
  downLoadPdf(params = {}, filename = "modbus.pdf") {
    return request
      .post(`/myData/exportPdf`, params, { responseType: "blob" })
      .then((data) => {
        const blob = new Blob([data]);
        saveAs(blob, filename);
      });
  },
  categorizeList() {
    return request.get("/myData/categorizeList");
  },
  clearTable() {
    return request.get("/myData/clearTable");
  },
  switch(url) {
    return request.get(`${"/myProperity/" + url}`);
  },
  state() {
    return request.get("/myProperity/state");
  },
  getMyHeadinfoById() {
    return request.get("/myHeadinfo/getMyHeadinfoById");
  },
  saveupdate(params = {}) {
    return request.post("/myHeadinfo/saveupdate", params);
  },
  getMyTestresult(params = {}) {
    return request.get("/myTestresult/getMyTestresult", { params });
  },
  saveUpdate(params = {}) {
    return request.post("/myTestresult/saveUpdate", params);
  },
  findAdminPermissionPage(params = {}) {
    return request.get("/myTestresult/findMyTestresultPage", { params });
  },
};
